<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'gift_manage.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <script type="text/javascript">
  	function selChange(selObj){
  		window.location.href = "/crm/gift/queryByType?giftType="+selObj.options[selObj.selectedIndex].value;
  	} 
  	
  	function Del(nGiftno){
  	var flag = confirm("确定要删除吗？");
  	if(flag == true)
  	window.location.href = "/crm/gift/delete?nGiftno="+nGiftno;
  	}
  </script>
  
  <style type="text/css">
  table{
  	border-collapse: collapse;
  }
  table th,table td{
  	border:1px solid black;
  	text-align: center;
  }
  
  img{
  width: 100px;
  height: 50px;
  }
  </style>

  <body>
  
    兑换礼品管理
    <hr style="size: 2px">

	<div align="center" >
		<form action="/crm/gift/queryByName" method="post">
		商品类别&nbsp; 
			<select id="TypeSel" onchange="selChange(this)">
				<option value="全部" ${giftType == '全部'?'selected':''}>全部
				<option value="国内" ${giftType == '国内'?'selected':''}>国内
				<option value="国外" ${giftType == '国外'?'selected':''}>国外
			</select>
			商品名称：<input type="text" name="giftName">&nbsp; 
			<input type="submit" value="查询">
		</form>
	</div>
	<hr>
  	  礼品信息列表
  	 <table id="tt" class="easyui-datagrid" style="width:100%;height:auto" >
  		<thead>
  		<tr>
  			<th>礼品图片</th>
  			<th>礼品名称</th>
  			<th>礼品类别</th>
  			<th>库存</th>
  			<th>所需积分</th>
  			<th>操作<a href="/crm/gift/addData">【添加】</a></th>
  		</tr>
  		</thead>
  		<c:forEach items="${gift}" var="gift">
  			<tr>
  				<td><img src="${gift.vFile}"></td>
  				<td>${gift.vGiftname}</td>
  				<td>${gift.vGifttype}</td>
  				<td>${gift.nNum}</td>
  				<td>${gift.nSubs}</td>
  				<td>
  					<a href="/crm/gift/detail?nGiftno=${gift.nGiftno}">详细||</a>
  					<a href="/crm/gift/updateData?nGiftno=${gift.nGiftno}">修改||</a>
  					<a href="" onclick="Del(${gift.nGiftno});return false;">删除</a>
  				</td>
  			</tr>
  		</c:forEach>
  	</table>
  </body>
</html>
